﻿@model IList<AppHistory>
@using AntJob.Data.Entity
@using NewLife;
@using NewLife.Web;
@using XCode;
@using XCode.Configuration;
@using XCode.Membership;
@using NewLife.Cube;
@{
    var fact = ViewBag.Factory as IEntityFactory;
    var page = ViewBag.Page as Pager;
    var fields = ViewBag.Fields as IList<FieldItem>;
    var set = ViewBag.PageSetting as PageSetting;
    //var provider = ManageProvider.Provider;
}
<table class="table table-bordered table-hover table-striped table-condensed">
    <thead>
        <tr>
            @if (set.EnableSelect)
            {
                <th class="text-center" style="width:10px;"><input type="checkbox" id="chkAll" title="全选" /></th>
            }
            <th class="text-center"><a href="@Html.Raw(page.GetSortUrl("AppID"))">应用</a></th>
            <th class="text-center"><a href="@Html.Raw(page.GetSortUrl("Name"))">名称</a></th>
            <th class="text-center"><a href="@Html.Raw(page.GetSortUrl("Action"))">操作</a></th>
            <th class="text-center"><a href="@Html.Raw(page.GetSortUrl("Success"))">成功</a></th>
            <th class="text-center"><a href="@Html.Raw(page.GetSortUrl("Version"))">版本</a></th>
            <th class="text-center">内容</th>
            <th class="text-center" title="服务端。客户端登录到哪个服务端，IP加端口"><a href="@Html.Raw(page.GetSortUrl("Server"))">服务端</a></th>
            <th class="text-center" style="min-width:134px;"><a href="@Html.Raw(page.GetSortUrl("CreateTime"))">创建时间</a></th>
            <th class="text-center"><a href="@Html.Raw(page.GetSortUrl("CreateIP"))">创建地址</a></th>
            @if (this.Has(PermissionFlags.Detail, PermissionFlags.Update, PermissionFlags.Delete))
            {
                <th class="text-center">操作</th>
            }
        </tr>
    </thead>
    <tbody>
        @foreach (var entity in Model)
        {
            <tr>
                @if (set.EnableSelect)
                {
                    <td class="text-center"><input type="checkbox" name="keys" value="@entity.Id" /></td>
                }
                <td><a href="App?ID=@entity.AppID">@entity.AppName</a></td>
                <td>@entity.Name</td>
                <td>@entity.Action</td>
                <td class="text-center">
                    <i class="glyphicon glyphicon-@(entity.Success ? "ok" : "remove")" style="color: @(entity.Success ? "green" : "red");"></i>
                </td>
                <td title="@entity.CompileTime.ToFullString("")">@entity.Version</td>
                <td title="@entity.Remark" style="max-width:500px;overflow:hidden;white-space: nowrap;text-overflow: ellipsis;">@entity.Remark</td>
                <td>@entity.Server</td>
                <td class="text-center">@entity.CreateTime.ToFullString("")</td>
                <td class="text-center" title="@entity.CreateIP.IPToAddress()">@entity.CreateIP</td>
                @if (this.Has(PermissionFlags.Detail, PermissionFlags.Update, PermissionFlags.Delete))
                {
                    <td class="text-center">
                        @await Html.PartialAsync("_List_Data_Action", (Object)entity)
                    </td>
                }
            </tr>
        }
        @if (page.State != null)
        {
            var entity = page.State as AppHistory;
            <tr>
                @if (set.EnableSelect)
                {
                    <td></td>
                }
                <td class="text-center">总计</td>
                <td></td>
                <td></td>
                <td></td>
                <td></td>
                <td></td>
                <td></td>
                <td></td>
                <td></td>
                <td></td>

                @if (this.Has(PermissionFlags.Detail, PermissionFlags.Update, PermissionFlags.Delete))
                {
                    <td></td>
                }
            </tr>
        }
    </tbody>
</table>